#include <../comm.h>
class Solution {
public:
    vector<vector<int>> findWinners(vector<vector<int>>& matches) {
        map<int, int> hsh;
        set<int> ff, loser;
        for(auto& e: matches)
        {
            int l = e[1], w = e[0];
            loser.insert(l), ff.insert(l), ff.insert(w), hsh[l]++;
        }
        vector<vector<int>> ans(2);
        for(auto& [k, time]: hsh)
            if(time == 1)
                ans[1].push_back(k);
        for(auto e: ff)
            if(loser.count(e) == 0)
                ans[0].push_back(e);
        return ans; 
    }
};